$(function() {
    var doresetpwdurl = '/community/do_reset_pwd';
    //提交
    $('#submit').click(function() {
        var verifyCodeActual = $('#j_captcha').val();
        if (!verifyCodeActual) {
            alert('请输入验证码');
            return;
        }
        var pwd = $('#pwd').val();
        var repwd = $('#re_pwd').val();
        if (!pwd){
            alert('必须输入新密码');
            return;
        }else if (!repwd){
            alert('必须输入确认密码');
            return;
        }else if (pwd != repwd){
            alert('两次密码输入的值不一致!');
            return;
        }
        var formData = new FormData();
        formData.append("verifyCodeActual", verifyCodeActual);
        formData.append('email', $('#email').val());
        formData.append('code', $('#code').val());
        formData.append('password', $('#pwd').val());
        $.ajax({
            // url : (isEdit? editShopUrl:addShopUrl),
            url : doresetpwdurl,
            type : 'POST',
            data : formData,
            contentType : false,
            processData : false,
            cache : false,
            success : function(data) {
                if (data.success) {
                    alert('密码更改成功,请使用新密码进行登录!');
                    window.setTimeout("window.location='/user/userlogin'",1000);
                    // }
                } else {
                    alert(data.errMsg);
                    // $('#captcha_img').click();
                }
            }
        });
    });

});